home *** CD-ROM | disk | FTP | other *** search
/ kermit.columbia.edu / kermit.columbia.edu.tar / kermit.columbia.edu / newsgroups / misc.20041116-20060924 / 000403_fdc@panix.com_Sun Aug 20 16:07:57 2006.msg < prev    next >
Internet Message Format  |  2006-09-27  |  2KB

  1. Path: reader2.panix.com!reader1.panix.com!panix!not-for-mail
  2. From: Frank Da Cruz <fdc@panix.com>
  3. Newsgroups: comp.protocols.kermit.misc
  4. Subject: Re: logging / flushing output
  5. Date: Sun, 20 Aug 2006 20:02:15 +0000 (UTC)
  6. Organization: PANIX Public Access Internet and UNIX, NYC
  7. Lines: 45
  8. Message-ID: <slrneehfu7.j1o.fdc@panix2.panix.com>
  9. References: <1155487576.755318.253070@b28g2000cwb.googlegroups.com>
  10. Reply-To: fdc@columbia.edu
  11. NNTP-Posting-Host: panix2.panix.com
  12. X-Trace: reader2.panix.com 1156104135 29274 166.84.1.2 (20 Aug 2006 20:02:15 GMT)
  13. X-Complaints-To: abuse@panix.com
  14. NNTP-Posting-Date: Sun, 20 Aug 2006 20:02:15 +0000 (UTC)
  15. User-Agent: slrn/0.9.8.0 (NetBSD)
  16. Xref: panix comp.protocols.kermit.misc:15535
  17.  
  18. On 2006-08-13, tomviolin <rock_spambust_violin@yahoo.com> wrote:
  19. : System: C-Kermit 8.0.211 on Linux 2.6 (Ubuntu).
  20. :
  21. : I have a simple script that does a straightforward interactive chat
  22. : with a remote system.  Basically it is INPUTs and OUTPUTs, with ECHO
  23. : statements describing the action (e.g. ECHO "Waiting for login:").
  24. :
  25. : I use the script as a "kerbang" script (starting with
  26. : #!/usr/local/bin/kermit +), have "set input echo on" and when I run the
  27. : script at the terminal it works as expected, with the output from the
  28. : remote system interspersed with the text from the ECHO statements.
  29. :
  30. : However, when I redirect the output to a file thusly:
  31. :
  32. :   $ ./script.ksc  > script.log 2>&1
  33. :
  34. : strange things happen.  Doing a "tail -f script.log" from another
  35. : window (or backgrounding the script and doing the "tail" from the same
  36. : window) reveals that the output from the remote system is showing up in
  37. : real time, but the output from the ECHO statements is not showing up
  38. : until the script terminates.
  39. :
  40. : Why is this?
  41. :
  42. I/O across the connection is buffered, ECHO commands are not.
  43.  
  44. : It seems like the output from the input echo is going to
  45. : a buffer that is being flushed regularly, while the output from the
  46. : ECHO statements is going into another buffer that isn't being flushed.
  47. : Strange.
  48. :
  49. : Any way to correct this behavior?  I'd like to be able to monitor the
  50. : progress of a background Kermit task in real time.
  51. :
  52. Instead of:
  53.  
  54.   ECHO "Waiting for login:"
  55.  
  56. use:
  57.  
  58.   WRITELN ERROR "Waiting for login:"
  59.  
  60. This writes the string to stderr, which is not buffered.
  61.  
  62. - Frank